home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0"?>
-
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fd="http://www.bradsoft.com/feeddemon/xmlns/1.0/">
- <xsl:output method="html"/>
-
- <!-- images -->
- <xsl:variable name="collapse-img" select="'$IMAGEDIR$collapse.gif'"/>
- <xsl:variable name="expand-img" select="'$IMAGEDIR$expand.gif'"/>
- <xsl:variable name="enclosure-img" select="'$IMAGEDIR$enclosure.gif'"/>
- <xsl:variable name="comment-img" select="'$IMAGEDIR$comments.gif'"/>
- <xsl:variable name="link-img" select="'$IMAGEDIR$link.gif'"/>
-
- <!-- count of news items -->
- <xsl:variable name="item-count" select="count(/newspaper/channel/item)"/>
-
- <!-- default class for item detail - defaults to collapsed unless this is a single item newspaper -->
- <xsl:variable name="item-detail-class">
- <xsl:choose>
- <xsl:when test="$item-count=1">expanded</xsl:when>
- <xsl:otherwise>collapsed</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="common-styles">
- <style type="text/css">
- body, div.channelnewsitems { background-color: #F2F9FB; }
- body {
- font: 84% "Trebuchet MS", Tahoma, sans-serif;
- margin: 8px 16px;
- filter: progid:DXImageTransform.Microsoft.Gradient(gradientType=1,startColorStr=#EFF6F8,endColorStr=#CAE5EA);
- }
- a { color: #006ABA; }
- a:hover { color: #C3756F; }
- span.nodescription { font-size: x-small; color: silver;}
- div.newspapertitle { font-weight: bold; font-size: 130%; text-align: center; margin: 16px 2px; }
- div.newsitemtitle { }
- div.newsitem { margin-bottom: 4px; }
- div.newsitemcontent {
- margin: 6px 18px;
- border: 1px solid #C2E0E7;
- padding: 8px 16px;
- color: #484848;
- background-color: white;
- overflow: visible;
- /*height: 1px; */
- }
- .newsitemsource, .dateline { color: #898989; font-size: xx-small; }
- .newsitemsource { text-align: right; }
- .collapsed { display: none; }
- img.icon { border: none; }
- img.button { margin-right: 6px; }
- /*div.newsitem { border-bottom: 1px dotted #D8D8D8; }*/
- </style>
- </xsl:variable>
-
- <xsl:variable name="common-scripts">
- <script>
- function collapseItem(itemid) {
- document.getElementById(itemid + '_expanded').style.display = 'inline';
- document.getElementById(itemid + '_collapsed').style.display = 'none';
- document.getElementById(itemid + '_detail').style.display = 'none';
- }
- function expandItem(itemid) {
- document.getElementById(itemid + '_expanded').style.display = 'none';
- document.getElementById(itemid + '_collapsed').style.display = 'inline';
- document.getElementById(itemid + '_detail').style.display = 'block';
- }
- </script>
- </xsl:variable>
-
- <!-- channel group -->
- <xsl:template match="newspaper[@type='group']">
- <html>
- <head>
- <title>Group Newspaper</title>
- <xsl:copy-of select="$common-styles"/>
- <style type="text/css">
- div.newsitem { padding-bottom: 1px; }
- div.newsitem, div.channelnewsitems { background-color: #F7FBFC; }
- div.channelnewsitems, div.channeltitle { border: 1px solid #52AABE; }
- div.channelnewsitems { padding: 8px 12px; margin-bottom: 14px; }
- div.channeltitle { border-bottom: none; font-weight: bold; text-transform: uppercase; text-align: center; background-color: #A0D3E1; }
- div.channeltitle, div.channeltitle a { color: #256576; text-decoration: none; }
- </style>
- <xsl:copy-of select="$common-scripts"/>
- </head>
- <body>
- <xsl:if test="title">
- <div class="newspapertitle">
- <xsl:value-of select="title" disable-output-escaping="yes"/>
- </div>
- </xsl:if>
-
- <xsl:for-each select="channel">
- <div class="channeltitle">
- <xsl:variable name="chanlink" select="link"/>
- <a href="{$chanlink}"><xsl:value-of select="title"/></a>
- </div>
- <div class="channelnewsitems">
- <xsl:for-each select="item">
- <xsl:sort select="fd:sortKey" data-type="number" order="descending"/>
- <xsl:apply-templates select="."/>
- </xsl:for-each>
- </div>
- </xsl:for-each>
- </body>
- </html>
- </xsl:template>
-
- <!-- news item and channel -->
- <xsl:template match="newspaper[@type='newsitem' or @type='channel']">
- <html>
- <head>
- <title>Newspaper</title>
- <xsl:copy-of select="$common-styles"/>
- <xsl:copy-of select="$common-scripts"/>
- </head>
- <body>
- <xsl:if test="title">
- <div class="newspapertitle">
- <xsl:value-of select="title" disable-output-escaping="yes"/>
- </div>
- </xsl:if>
- <xsl:for-each select="channel/item">
- <xsl:sort select="fd:sortKey" data-type="number" order="descending"/>
- <xsl:apply-templates select="."/>
- </xsl:for-each>
- </body>
- </html>
- </xsl:template>
-
- <!-- news item template -->
- <xsl:template match="item">
- <!-- generate unique ID for this item -->
- <xsl:variable name="itemid"><xsl:value-of select="generate-id()"/></xsl:variable>
-
- <div class="newsitem">
- <div class="newsitemtitle">
- <!-- don't show +/- for single item newspaper -->
- <xsl:if test="$item-count > 1">
- <a class="expanded" href="javascript:expandItem('{$itemid}')" id="{$itemid}_expanded">
- <img src="{$expand-img}" border="0" align="absmiddle" class="button" />
- </a>
- <a class="collapsed" href="javascript:collapseItem('{$itemid}')" id="{$itemid}_collapsed">
- <img src="{$collapse-img}" border="0" align="absmiddle" class="button" />
- </a>
- </xsl:if>
-
- <xsl:variable name="itemlink" select="link"/>
- <a href="{$itemlink}"><xsl:value-of select="title" disable-output-escaping="yes"/></a>
- <span class="dateline">
- [ <xsl:value-of select="fd:dateDisplay"/> ]
- </span>
- </div>
- <div id="{$itemid}_detail" class="{$item-detail-class}">
- <div class="newsitemcontent">
- <xsl:value-of select="description" disable-output-escaping="yes"/>
- <div class="newsitemsource">
- <xsl:variable name="srclink" select="source/@htmlUrl"/>
- [
- <xsl:if test="author"><xsl:value-of select="author" disable-output-escaping="yes"/> | </xsl:if>
- <a href="{$srclink}"><xsl:value-of select="source"/></a>
- <!-- add link to comments if available -->
- <xsl:if test="comments">
- <xsl:variable name="commentlink" select="comments"/>
- | <a href="{$commentlink}"><img src="{$comment-img}" class="icon" align="absmiddle" /></a>
- </xsl:if>
- <!-- add link to enclosure if available -->
- <xsl:if test="enclosure">
- <xsl:variable name="enclosurelink" select="enclosure/@url"/>
- | <a href="{$enclosurelink}" title="{$enclosurelink}"><img src="{$enclosure-img}" class="icon" align="absmiddle" /></a>
- </xsl:if>
- ]
- </div>
- </div>
- </div>
- </div>
- </xsl:template>
-
- </xsl:stylesheet>